package com.man.ini4j;

import java.io.File;
import java.io.IOException;

import org.ini4j.InvalidFileFormatException;
import org.ini4j.Wini;

public class Ini4jTest {
	public static void main(String[] args) throws InvalidFileFormatException, IOException {
		// read();
		 write();
	}

	private static void write() throws IOException, InvalidFileFormatException {
		Wini ini = new Wini(new File("G:\\Config.ini"));
		 ini.put("sleepy", "age", 550);
		 ini.put("sleepy", "weight", 45.6);
		 ini.store();
	}

	private static void read() throws IOException, InvalidFileFormatException {
		Wini ini = new Wini(new File("G:\\Config.ini"));
	     int age = ini.get("happy", "age", int.class);
	     double height = ini.get("happy", "height", double.class);
	     String dir = ini.get("happy", "homeDir");
	     System.out.println(age+" "+height+" "+dir);
	}
}
